home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20000114-20000217
/
000140_news@columbia.edu _Tue Jan 25 12:57:45 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
3KB
Return-Path: <news@columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id MAA06669
for <kermit.misc@watsun.cc.columbia.edu>; Tue, 25 Jan 2000 12:57:45 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id MAA15118
for kermit.misc@watsun.cc.columbia.edu; Tue, 25 Jan 2000 12:55:56 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Subject: Re: Changing Unix C-kermit> prompt
Date: 25 Jan 2000 17:55:53 GMT
Organization: Columbia University
Message-ID: <86ko39$enr$1@newsmaster.cc.columbia.edu>
To: kermit.misc@columbia.edu
In article <388DD7E6.ED7EA6A6@seanet.com>,
Peter Burkholder <peter@geophys.washington.edu> wrote:
: I'm doing some script writing rather deep in my directory
: tree, so I'm always looking at a prompt like:
:
: (/export/home/badger/spyder/kermit/ck7/) C-Kermit>
:
: which hardly leaves space for my commands w/o wrapping. I don't
: see in the book or documentation how I truncate the current
: directory listing, but I hope there is. I'd be happy with;
: (ck7) C-Kermit>
:
The prompt definition can contain macros, variables, function calls,
or anything else. The definition is re-evaluated each time the prompt
changes. The default definition is:
(\v(directory)) C-Kermit>
which shows the current directory in parentheses; if you give a CD
command, the prompt changes.
C-Kermit 7.0 includes a lot of new string functions. Unfortunately, none
of them does exactly what you need (one of them, \fstripx(), does exactly
the opposite: removes the rightmost segment from the string).
But where there's a will, there's a way:
set prompt (\freplace(\fsubstr(\v(dir),\frindex(/,\v(dir),2)),/,)) C-Kermit>
In which:
\frindex(/,\v(dir),2)
Gives the position of the rightmost slash not counting the trailing one.
\fsubstr(\v(dir),\frindex(/,\v(dir),2))
Gives the rightmost directory segment, with slashes
\freplace(\fsubstr(\v(dir),\frindex(/,\v(dir),2)),/,)
Removes the the slashes.
The result, in your case, should be:
(ck7) C-Kermit>
You can achieve any other desired effect with C-Kermit's string functions.
Most of them are documented in "Using C-Kermit". New ones are documented
in the ckermit2.txt file. The SHOW FUNCTIONS command lists the functions
that are available. In C-Kermit 7.0, you can get help on a particular
function with:
help function xxx
where xxx is the function name. This tells you the calling sequence,
action, and return value.
- Frank